<?php
/**
 * A simple description for this script
 *
 * PHP Version 5.2.0 or Upper version
 *
 * @package    Paylog
 * @author     Hidehito NOZAWA aka Suin <http://suin.asia>
 * @copyright  2010 Hidehito NOZAWA
 * @license    http://www.gnu.org/licenses/gpl-2.0.html GNU GPL v2
 *
 */

class Paylog_Controller_Groups extends Paylog_Abstract_Controller
{
	protected $groupHand = null;

	public function __construct()
	{
		parent::__construct();

		$this->groupHand = new Paylog_Object_GroupHandler;
	}

	public function main()
	{
		$this->_default();
	}

	protected function _default()
	{
		$groupObjs = $this->groupHand->loadOrderByWeight();

		$this->output['total']  = count($groupObjs);
		$this->output['groups'] = array();

		foreach ( $groupObjs as $groupObj )
		{
			$this->output['groups'][] = array(
				'id'     => $groupObj->getVar('id'),
				'name'   => $groupObj->getVar('name'),
				'weight' => $groupObj->getVar('weight'),
			);
		}

		$this->_view();
	}
}

?>
